var window = $global.window;
var document = window.document;
var XMLHttpRequest = window.XMLHttpRequest;
var Laya = window.Laya;
var Laya3D = window.Laya3D;
"use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

(function () {
  'use strict';
  /**This class is automatically generated by LayaAirIDE, please do not make any modifications. */

  var GameConfig =
  /*#__PURE__*/
  function () {
    function GameConfig() {
      _classCallCheck(this, GameConfig);
    }

    _createClass(GameConfig, null, [{
      key: "init",
      value: function init() {
        //注册Script或者Runtime引用
        var reg = Laya.ClassUtils.regClass;
      }
    }]);

    return GameConfig;
  }();

  GameConfig.width = 640;
  GameConfig.height = 1136;
  GameConfig.scaleMode = "fixedwidth";
  GameConfig.screenMode = "none";
  GameConfig.alignV = "top";
  GameConfig.alignH = "left";
  GameConfig.startScene = "";
  GameConfig.sceneRoot = "";
  GameConfig.debug = false;
  GameConfig.stat = false;
  GameConfig.physicsDebug = false;
  GameConfig.exportSceneToJson = true;
  GameConfig.init();
  var ConstStrings = {
    pageTitle: "拼出三双AJ鞋",
    selectedViewItemBg: "res/scene/select_item_bg.png",
    candidateSelectedImg: "res/scene/shipin.png",
    circleMask: "res/scene/circle_mask.png",
    testPartLayData: {
      id: "shoe-0",
      des: "AJ-Shoe0",
      faceData: [{
        id: "shoe-0_face-0",
        // 面id
        des: "shoe-0_face-0",
        // 面描述
        backgroudWholeImg: "",
        // 全背景
        backgroudOutlineImg: "res/scene/parts/face-0-whole.png",
        // 轮廓背景
        partyLays: [{
          layId: "shoe-0_partLay-0",
          layDes: "第一双鞋的第一个层",
          wholeImg: "res/scene/parts/party-0.png",
          // 完整填充图片
          outlineImg: "res/scene/parts/party-0-outline.png",
          // 轮廓填充图片
          outlineMaskImg: "res/scene/parts/party-0-outline_m.png",
          // 轮廓填充图片
          backgroudOutlineImg: "res/scene/parts/face-0-whole.png",
          // 轮廓背景
          partyPolygonPoints: [{
            x: 0.8,
            y: 0.11
          }, {
            x: 0.95,
            y: 0.11
          }, {
            x: 0.95,
            y: 0.2
          }, {
            x: 0.8,
            y: 0.2
          }]
        }, {
          layId: "shoe-0_partLay-1",
          layDes: "第一双鞋的第一个层",
          wholeImg: "res/scene/parts/party-2.png",
          // 完整填充图片
          outlineImg: "res/scene/parts/party-2-outline.png",
          // 轮廓填充图片
          outlineMaskImg: "res/scene/parts/party-2-outline_m.png",
          // 轮廓mask
          backgroudOutlineImg: "res/scene/parts/face-0-whole.png",
          // 轮廓背景
          partyPolygonPoints: [{
            x: 0.2,
            y: 0.5
          }, {
            x: 0.7,
            y: 0.5
          }, {
            x: 0.7,
            y: 0.85
          }, {
            x: 0.2,
            y: 0.85
          }]
        }, {
          layId: "shoe-0_partLay-2",
          layDes: "第一双鞋的第一个层",
          wholeImg: "res/scene/parts/party-3.png",
          // 完整填充图片
          outlineImg: "res/scene/parts/party-3-outline.png",
          // 轮廓填充图片
          outlineMaskImg: "res/scene/parts/party-3-outline_m.png",
          // 轮廓填充图片
          backgroudOutlineImg: "res/scene/parts/face-0-whole.png",
          // 轮廓背景
          partyPolygonPoints: [{
            x: 0.6,
            y: 0.47
          }, {
            x: 0.95,
            y: 0.47
          }, {
            x: 0.95,
            y: 0.83
          }, {
            x: 0.6,
            y: 0.83
          }]
        }]
      }],
      candidateDatas: [{
        candidateId: "shoe-0_partLay-0",
        candidateImgRes: "res/scene/0.png"
      }, {
        candidateId: "shoe-0_partLay-1",
        candidateImgRes: "res/scene/1.png"
      }, {
        candidateId: "shoe-0_partLay-2",
        candidateImgRes: "res/scene/2.png"
      }, {
        candidateId: "shoe-0_partLay-3",
        candidateImgRes: "res/scene/3.png"
      }, {
        candidateId: "shoe-0_partLay-4",
        candidateImgRes: "res/scene/4.png"
      }, {
        candidateId: "shoe-0_partLay-5",
        candidateImgRes: "res/scene/5.png"
      }, {
        candidateId: "shoe-0_partLay-6",
        candidateImgRes: "res/scene/6.png"
      }, {
        candidateId: "shoe-0_partLay-7",
        candidateImgRes: "res/scene/7.png"
      }, {
        candidateId: "shoe-0_partLay-8",
        candidateImgRes: "res/scene/8.png"
      }, {
        candidateId: "shoe-0_partLay-9",
        candidateImgRes: "res/scene/9.png"
      }]
    }
  };
  var showZoneWID = 0; // 展示区域宽度

  var showZoneHEI = 0; // 展示区域高度

  var showZoneMarginLeftRight = 100; // 展示区域左右间隔  marginLeft marginRight

  var showZoneMarginUp = 100; // 展示区域左右间隔  marginTop

  var ShowShoeZone =
  /*#__PURE__*/
  function (_Laya$Sprite) {
    _inherits(ShowShoeZone, _Laya$Sprite);

    function ShowShoeZone() {
      var _this;

      _classCallCheck(this, ShowShoeZone);

      _this = _possibleConstructorReturn(this, _getPrototypeOf(ShowShoeZone).call(this));
      _this.showZoneData = {}; // 展示区域数据
      // 当前的面index 每双鞋有多个面 每个面包含多个拼图碎片区域

      _this.selectedFaceIndex = 0; // 显示区域底图 用于显示鞋子轮廓地图

      _this.viewBackOutLine = {}; // 碎片区域list

      _this.viewLayers = []; // 画布宽度 - marginLeft - marginRight

      showZoneWID = Laya.stage.width - showZoneMarginLeftRight * 2; // 正方形

      showZoneHEI = showZoneWID * 1;

      _this.size(showZoneWID, showZoneHEI);

      _this.pos(showZoneMarginLeftRight, showZoneMarginUp);

      return _this;
    }
    /**
     * 初始化展示区域
     * @param {*} inData 传入区域鞋子的数据
     */


    _createClass(ShowShoeZone, [{
      key: "initShowZoneData",
      value: function initShowZoneData(inData) {
        this.showZoneData = inData;
        this.switchFace(0); // 首次加载第一个面
      }
      /**
       * 加载面数据 组织场景 
       * @param {*} index 面index
       */

    }, {
      key: "switchFace",
      value: function switchFace(index) {
        this.selectedFaceIndex = index;
        this.destroyChildren();
        this.viewLayers = []; // 面数据

        var tempFaceData = this.showZoneData.faceData[index];
        this.viewBackOutLine = new Laya.Sprite();
        this.addChild(this.viewBackOutLine);
        this.viewBackOutLine.size(showZoneWID, showZoneHEI);
        this.viewBackOutLine.loadImage(tempFaceData.backgroudOutlineImg); // 面底图

        this.viewBackOutLine.visible = true; // 初始化碎片图层

        for (var i = 0; i < tempFaceData.partyLays.length; i++) {
          var temp = new PartLay();
          temp.intLayData(tempFaceData.partyLays[i]);
          this.viewLayers.push(temp);
          this.addChild(temp);
        }
      }
      /**
       * 显示可供放置的碎片图层 图层的轮廓img
       * @param {*} inData 用于筛选
       * @param {*} isShow 是否显示
       */

    }, {
      key: "showCandidateLayer",
      value: function showCandidateLayer(inData, isShow) {
        this.viewLayers.forEach(function (element) {
          element.setPartLayOutLineImgVisible(isShow);
        });
      }
      /**
       * 鼠标位置是否在碎片多边形区域内
       * @param {*} stageX 鼠标x
       * @param {*} stageY 鼠标y
       * @param {*} data 选中时替换data中的img
       */

    }, {
      key: "checkHitAndChangeImage",
      value: function checkHitAndChangeImage(stageX, stageY, data) {
        var tempViewX = stageX;
        var tempViewY = stageY;

        for (var i = 0; i < this.viewLayers.length; i++) {
          var tempLayer = this.viewLayers[i];

          if (tempLayer.checkIsTouchInPolygon(tempViewX, tempViewY)) {
            tempLayer.setPartLayWholeImgVisible(true);
            tempLayer.changePartLayWholeImgRes(data.candidateImgRes);
          }
        }
      }
    }]);

    return ShowShoeZone;
  }(Laya.Sprite);
  /**
   * 碎片图层
   */


  var PartLay =
  /*#__PURE__*/
  function (_Laya$Sprite2) {
    _inherits(PartLay, _Laya$Sprite2);

    function PartLay() {
      var _this2;

      _classCallCheck(this, PartLay);

      _this2 = _possibleConstructorReturn(this, _getPrototypeOf(PartLay).call(this));
      _this2.partLayData = {}; // 轮廓图mask

      _this2.viewPartLayOutLineMaskImg = {}; // 轮廓图view line

      _this2.viewPartLayOutLineImg = {}; // 全图view 

      _this2.viewPartLayWholeImg = {}; // 区域多边形

      _this2.viewPartLayPolygon = {};

      _this2.size(showZoneWID, showZoneHEI);

      return _this2;
    }

    _createClass(PartLay, [{
      key: "intLayData",
      value: function intLayData(inData) {
        this.partLayData = inData;
        this.viewPartLayOutLineImg = new Laya.Sprite();
        this.addChild(this.viewPartLayOutLineImg);
        this.viewPartLayOutLineImg.size(showZoneWID, showZoneHEI);
        this.viewPartLayOutLineImg.visible = false;
        this.viewPartLayOutLineImg.loadImage(inData.outlineImg);
        this.viewPartLayOutLineMaskImg = new Laya.Sprite();
        this.viewPartLayOutLineMaskImg.size(showZoneWID, showZoneHEI);
        this.viewPartLayOutLineMaskImg.loadImage(inData.outlineMaskImg);
        this.viewPartLayWholeImg = new Laya.Sprite();
        this.addChild(this.viewPartLayWholeImg);
        this.viewPartLayWholeImg.size(showZoneWID, showZoneHEI);
        this.viewPartLayWholeImg.visible = false;
        this.viewPartLayWholeImg.loadImage(inData.backgroudOutlineImg);
        this.viewPartLayWholeImg.mask = this.viewPartLayOutLineMaskImg;
        this.viewPartLayPolygon = new Laya.Sprite();
        this.addChild(this.viewPartLayPolygon);
        var pointStartX = 0,
            pointStartY = 0;
        var points = [];
        pointStartX = inData.partyPolygonPoints[0].x * showZoneWID;
        pointStartY = inData.partyPolygonPoints[0].y * showZoneHEI;

        for (var i = 0; i < inData.partyPolygonPoints.length; i++) {
          var temp = [];
          temp.push(i == 0 ? "moveTo" : "lineTo");
          temp.push(inData.partyPolygonPoints[i].x * showZoneWID);
          temp.push(inData.partyPolygonPoints[i].y * showZoneHEI);
          points.push(temp);
        }

        this.viewPartLayPolygon.graphics.drawPath(20, 10, points, {
          "fillStyle": "#ff000055"
        });
        this.viewPartLayPolygon.visible = false;
      }
      /**
      * 判断点在多边形内
      * param checkPoint被测点，polygonPoints范围点
      */

    }, {
      key: "checkIsTouchInPolygon",
      value: function checkIsTouchInPolygon(inMouseX, inMouseY) {
        //        function isInPolygon(checkPoint, polygonPoints) {
        var counter = 0;
        var i;
        var xinters;
        var p1, p2;
        var polygonPoints = this.partLayData.partyPolygonPoints;
        var pointCount = polygonPoints.length; // var checkPoint = [inMouseX , inMouseY];

        p1 = polygonPoints[0];

        for (i = 1; i <= pointCount; i++) {
          p2 = polygonPoints[i % pointCount];
          var p1x = p1.x * showZoneWID + showZoneMarginLeftRight;
          var p1y = p1.y * showZoneHEI + showZoneMarginUp;
          var p2x = p2.x * showZoneWID + showZoneMarginLeftRight;
          var p2y = p2.y * showZoneHEI + showZoneMarginUp;

          if (inMouseX > Math.min(p1x, p2x) && inMouseX <= Math.max(p1x, p2x)) {
            if (inMouseY <= Math.max(p1y, p2y)) {
              if (p1x != p2x) {
                xinters = (inMouseX - p1x) * (p2y - p1y) / (p2x - p1x) + p1y;

                if (p1y == p2.y || inMouseY <= xinters) {
                  counter++;
                }
              }
            }
          }

          p1 = p2;
        }

        if (counter % 2 == 0) {
          return false;
        } else {
          return true;
        }
      }
    }, {
      key: "setPolygonIsVisible",
      value: function setPolygonIsVisible(e) {
        this.viewPartLayPolygon.visible = e;
      }
    }, {
      key: "setPartLayOutLineImgVisible",
      value: function setPartLayOutLineImgVisible(e) {
        this.viewPartLayOutLineImg.visible = e;
      }
    }, {
      key: "setPartLayWholeImgVisible",
      value: function setPartLayWholeImgVisible(e) {
        this.viewPartLayWholeImg.visible = e;
      }
    }, {
      key: "changePartLayWholeImgRes",
      value: function changePartLayWholeImgRes(e) {
        this.viewPartLayWholeImg.loadImage(e);
      }
    }]);

    return PartLay;
  }(Laya.Sprite); // CandidataZone.js


  var testPic = "res/scene/select_item_bg.png"; // 显示区域宽高

  var candidateZoneWID = 0;
  var candidateZoneHEI = 0;
  var candidateZoneMarginLeftRight = 100;
  var candidateZoneMarginUp = 600;
  var candidateItemSumH = 4;
  var candidateItemWID = 0;
  var candidateItemHEI = 0;
  /**
   * 
   */

  var CandidataZone =
  /*#__PURE__*/
  function (_Laya$Sprite3) {
    _inherits(CandidataZone, _Laya$Sprite3);

    function CandidataZone() {
      var _this3;

      _classCallCheck(this, CandidataZone);

      _this3 = _possibleConstructorReturn(this, _getPrototypeOf(CandidataZone).call(this)); // 候选区域数据

      _this3.candidateDatas = []; // 父组件 用于回调父类方法

      _this3.sceneParent = null;
      candidateZoneWID = Laya.stage.width - candidateZoneMarginLeftRight * 2;
      candidateZoneHEI = candidateZoneWID * 1;
      candidateItemWID = candidateZoneWID / candidateItemSumH;
      candidateItemHEI = candidateItemWID * 1;

      _this3.size(candidateZoneWID, candidateZoneHEI);

      _this3.pos(candidateZoneMarginLeftRight, candidateZoneMarginUp);

      _this3.loadImage(ConstStrings.selectedViewItemBg); // 列表


      _this3.viewCandidateList = {};
      return _this3;
    }
    /**
     * list  鼠标选中
     * @param {*} e 
     * @param {*} index 
     */


    _createClass(CandidataZone, [{
      key: "onCandidateSelect",
      value: function onCandidateSelect(e, index) {
        if (e.type != "mousedown") return;
        var tempCell = this.viewCandidateList.getCell(index);
        this.sceneParent.updateCandidateSelectItemData(index, tempCell.dataSource);
      }
      /**
       * list  ui更新
       * @param {*} e 
       * @param {*} index 
       */

    }, {
      key: "updateCandidateItem",
      value: function updateCandidateItem(cell, index) {
        cell.setSrcImg(cell.dataSource.candidateImgRes);
      }
    }, {
      key: "setCandidateData",
      value: function setCandidateData(e) {
        this.destroyChildren();
        this.candidateDatas = e;
        this.viewCandidateList = new Laya.List();
        this.addChild(this.viewCandidateList);
        this.viewCandidateList.itemRender = CandidateItemView;
        this.viewCandidateList.repeatX = 4;
        this.viewCandidateList.repeatY = 3;
        this.viewCandidateList.mouseHandler = new Laya.Handler(this, this.onCandidateSelect);
        this.viewCandidateList.renderHandler = new Laya.Handler(this, this.updateCandidateItem);
        this.viewCandidateList.array = this.candidateDatas;
      }
    }, {
      key: "setSceneParent",
      value: function setSceneParent(e) {
        this.sceneParent = e;
      }
    }]);

    return CandidataZone;
  }(Laya.Sprite);

  var CandidateItemView =
  /*#__PURE__*/
  function (_Laya$Box) {
    _inherits(CandidateItemView, _Laya$Box);

    function CandidateItemView() {
      var _this4;

      _classCallCheck(this, CandidateItemView);

      _this4 = _possibleConstructorReturn(this, _getPrototypeOf(CandidateItemView).call(this));
      _this4.viewImage = {};
      _this4.viewImageMask = {};

      _this4.size(candidateItemWID, candidateItemHEI);

      _this4.viewImage = new Laya.Sprite();

      _this4.viewImage.size(candidateItemWID, candidateItemHEI);

      _this4.addChild(_this4.viewImage);

      _this4.viewImageMask = new Laya.Sprite();

      _this4.viewImageMask.size(candidateItemWID, candidateItemHEI);

      _this4.viewImageMask.loadImage(ConstStrings.circleMask);

      _this4.viewImage.mask = _this4.viewImageMask;
      return _this4;
    }

    _createClass(CandidateItemView, [{
      key: "setSrcImg",
      value: function setSrcImg(src) {
        this.viewImage.loadImage(src);
      }
    }, {
      key: "isSelectImgVisible",
      value: function isSelectImgVisible(e) {
        this.selectImg.visible = e;
      }
    }]);

    return CandidateItemView;
  }(Laya.Box);

  var Main =
  /*#__PURE__*/
  function () {
    function Main() {
      _classCallCheck(this, Main);

      //根据IDE设置初始化引擎		
      if (window["Laya3D"]) Laya3D.init(GameConfig.width, GameConfig.height);else Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
      Laya["Physics"] && Laya["Physics"].enable();
      Laya["DebugPanel"] && Laya["DebugPanel"].enable();
      Laya.stage.scaleMode = GameConfig.scaleMode;
      Laya.stage.screenMode = GameConfig.screenMode;

      Laya.TBMiniAdapter.baseDir = "";

      Laya.stage.alignV = GameConfig.alignV;
      Laya.stage.alignH = GameConfig.alignH; //兼容微信不支持加载scene后缀场景

      Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson; //打开调试面板（通过IDE设置调试模式，或者url地址增加debug=true参数，均可打开调试面板）

      if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true") Laya.enableDebugPanel();
      if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"]) Laya["PhysicsDebugDraw"].enable();
      if (GameConfig.stat) Laya.Stat.show();
      Laya.alertGlobalError(true); //激活资源版本控制，version.json由IDE发布功能自动生成，如果没有也不影响后续流程

      Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
      this.ShowShoeZone = null;
      this.CandidataZone = null;
      this.viewMouseBall = {};
      this.viewMouseBallMask = {};
      this.candidata_mousedown_item_index = -1;
      this.candidata_mousedown_item_data = null;
      this.initScene();
    }

    _createClass(Main, [{
      key: "onVersionLoaded",
      value: function onVersionLoaded() {
        //激活大小图映射，加载小图的时候，如果发现小图在大图合集里面，则优先加载大图合集，而不是小图
        Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
      }
    }, {
      key: "onConfigLoaded",
      value: function onConfigLoaded() {
        //加载IDE指定的场景
        GameConfig.startScene && Laya.Scene.open(GameConfig.startScene);
      }
    }, {
      key: "initScene",
      value: function initScene() {
        // 场景背景色
        Laya.stage.bgColor = "#232628"; // demo 标题view

        var pageTitleView = new Laya.Text();
        pageTitleView.text = ConstStrings.pageTitle; //设置文本颜色

        pageTitleView.color = "#ffffff"; //设置文本字体
        // pageTitleView.font = "Ya Hei";
        //设置字体大小

        pageTitleView.fontSize = 32; //设置文本区背景

        pageTitleView.bgColor = "#c30c30"; //设置文本框的颜色

        pageTitleView.borderColor = "#23cfcf"; //设置粗体、斜体

        pageTitleView.bold = true; //设置斜体

        pageTitleView.italic = true;
        pageTitleView.width = 640;
        pageTitleView.height = 40;
        pageTitleView.pos(0, 50);
        pageTitleView.align = "center";
        pageTitleView.valign = "middle";
        Laya.stage.addChild(pageTitleView); // 上半部分鞋子区域

        this.ShowShoeZone = new ShowShoeZone();
        Laya.stage.addChild(this.ShowShoeZone);
        this.ShowShoeZone.initShowZoneData(ConstStrings.testPartLayData); // 下半部分碎片区域

        this.CandidataZone = new CandidataZone();
        Laya.stage.addChild(this.CandidataZone);
        this.CandidataZone.setCandidateData(ConstStrings.testPartLayData.candidateDatas);
        this.CandidataZone.setSceneParent(this); // 鼠标跟随球

        this.viewMouseBall = new Laya.Sprite();
        Laya.stage.addChild(this.viewMouseBall);
        this.viewMouseBall.zOrder = 1000; // 处于顶层

        this.viewMouseBall.size(Laya.stage.width * 0.1, Laya.stage.width * 0.1);
        this.viewMouseBall.pos(0, 0);
        this.viewMouseBall.visible = false; // 鼠标跟随球 mask

        this.viewMouseBallMask = new Laya.Sprite();
        this.viewMouseBallMask.size(Laya.stage.width * 0.1, Laya.stage.width * 0.1);
        this.viewMouseBallMask.loadImage(ConstStrings.circleMask);
        this.viewMouseBall.mask = this.viewMouseBallMask;
        Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.onMouseBallStartDrag);
        Laya.stage.on(Laya.Event.MOUSE_UP, this, this.onMouseBallEndDrag);
        Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.onMouseBallDraging);
      }
      /**
       * 更新选中的碎片序号和数据
       * @param {*} index 碎片的index
       * @param {*} data 碎片携带的数据
       */

    }, {
      key: "updateCandidateSelectItemData",
      value: function updateCandidateSelectItemData(index, data) {
        this.candidata_mousedown_item_index = index;
        this.candidata_mousedown_item_data = data;
      }
      /**
       * 鼠标点下
       * @param {*} e 
       */

    }, {
      key: "onMouseBallStartDrag",
      value: function onMouseBallStartDrag(e) {
        if (this.candidata_mousedown_item_index == -1 && this.candidata_mousedown_item_data == null) return;
        this.viewMouseBall.visible = true;
        this.viewMouseBall.pos(e.stageX - this.viewMouseBall.get_width() / 2, e.stageY - this.viewMouseBall.get_height() / 2);
        this.viewMouseBall.startDrag(null, false, 10, 300);
        this.viewMouseBall.loadImage(this.candidata_mousedown_item_data.candidateImgRes);
      }
      /**
       * 鼠标抬起
       * @param {*} e 
       */

    }, {
      key: "onMouseBallEndDrag",
      value: function onMouseBallEndDrag(e) {
        if (this.candidata_mousedown_item_index == -1 && this.candidata_mousedown_item_data == null) return;
        this.viewMouseBall.visible = false;
        this.viewMouseBall.stopDrag();
        this.ShowShoeZone.showCandidateLayer(this.candidata_mousedown_item_data, false);
        this.ShowShoeZone.checkHitAndChangeImage(e.stageX, e.stageY, this.candidata_mousedown_item_data);
        this.candidata_mousedown_item_index = -1;
        this.candidata_mousedown_item_data = null;
      }
      /**
       * 鼠标移动
       * @param {*} e 
       */

    }, {
      key: "onMouseBallDraging",
      value: function onMouseBallDraging(e) {
        if (this.candidata_mousedown_item_index == -1 && this.candidata_mousedown_item_data == null) return;
        this.ShowShoeZone.showCandidateLayer(this.candidata_mousedown_item_data, true);
      }
    }]);

    return Main;
  }(); //激活启动类


  new Main();
})();